<?php

require_once 'Basic.php';

class Report {
  
  const AS_ORDERED_LIST = 1;
  const AS_UNORDERED_LIST = 2;
  const AS_SIMPLE_PANEL = 3;
  
  private $items;
  
  public function __construct() {
    $this->items = array();
  }
  
  public function getHtml($as = Report::AS_SIMPLE_PANEL) {
    switch($as) {
      case Report::AS_ORDERED_LIST:
        $tagText = "ol";
        $itemTag = "li";
        break;
      case Report::AS_ORDERED_LIST:
        $tagText = "ul";
        $itemTag = "li";
        break;
      default:
        $tagText = "div";
        $itemTag = "div";
        break;
    }
    $out = "<${tagText} class='Report'>";
    foreach($this->items as $item) {
      $out .= "<${itemTag}>" . $item->getHtml() . "</${itemTag}>";
    }
    $out .= "</${tagText}>";
    return $out;
  }
  
  public function addItem(ReportItem $item) {
    $this->items[] = $item;
  }
  
}

